
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @author: guojianbo
* @since: 2022-04-23 12:45:29
*/
var log_1 = __webpack_require__(/*! ../utils/log */ "./src/core/utils/log.ts");
var analytics_1 = __webpack_require__(/*! _util/analytics */ "./src/core/utils/analytics.ts");
var report_util_1 = __webpack_require__(/*! ./report-util */ "./src/core/statistics/report-util.ts");
var deviceInfo_1 = __webpack_require__(/*! ../utils/deviceInfo */ "./src/core/utils/deviceInfo.ts");
var LVS_MAX_FAIL_COUNT = 3;
var LVSReport = /** @class */ (function () {
    function LVSReport() {
        this._failCount = 0;
    }
    LVSReport.prototype.reportLVS = function (_a) {
        var resultCode = _a.resultCode, _b = _a.errorMsg, errorMsg = _b === void 0 ? '' : _b, time = _a.time, _c = _a.domainUrl, domainUrl = _c === void 0 ? '' : _c;
        try {
            var reportData = {
                nm: 'lvs',
                val: {
                    result: resultCode,
                    http_result: resultCode,
                    path: errorMsg || '',
                    time: time > report_util_1.HTTP_REQUEST_MAX_TIMEOUT ? report_util_1.HTTP_REQUEST_MAX_TIMEOUT : time,
                    net: report_util_1.REPORT_NET_TYPE,
                    host: domainUrl || '',
                    status: deviceInfo_1.default.isHasNetwork() ? 0 : 1,
                },
            };
            if (resultCode == 0) {
                this._failCount = 0;
            }
            else {
                this._failCount++;
            }
            if (this._failCount > LVS_MAX_FAIL_COUNT) {
                log_1.default.error('LVSReport::reportLVS LVS_MAX_FAIL_COUNT');
                return;
            }
            analytics_1.default.report(reportData);
        }
        catch (error) {
            log_1.default.error('LVSReport::reportLVS error info:' + error);
        }
    };
    return LVSReport;
}());
exports.default = new LVSReport();


//# sourceURL=webpack://MTDX/./src/core/statistics/lvs-report.ts?